<!DOCTYPE html>
<script src="../../resources/ahem.js"></script>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<pre id="demo" style="font-family: Ahem; width: 2em; white-space: pre-wrap">a b </pre>
<p>Test for crbug.com/521047. Passes if find-in-page marker highlight is visible in both lines above.
<script>
function highlightRange(id, start, end, active) {
    var range = document.createRange();
    var elem = document.getElementById(id).firstChild;
    range.setStart(elem, start);
    range.setEnd(elem, end);
    if (window.internals) {
        internals.addTextMatchMarker(range, active);
        internals.setMarkedTextMatchesAreHighlighted(document, true);
    }
}

runAfterLayoutAndPaint(function() {
    highlightRange('demo', 0, 4, 'kActive');
}, true);
</script>
